﻿@inject IStringLocalizer<DisplayLabels> Localizer

<div class="row g-3">
    <div class="col-12">
        <Divider Text="@Localizer["BindWayCustomLabel"]" />
    </div>
    <div class="col-12">
        <p>@((MarkupString)Localizer["BindWayP2"].Value)</p>
    </div>
    <div class="col-12 col-sm-6">
        <Display @bind-Value="@Model.Name" DisplayText="@Localizer["BindWayCustomLabel"]" ShowLabel="true" />
    </div>
    <div class="col-12">
        <Divider Text="@Localizer["BindWayOccupants"]" />
    </div>
    <div class="col-12">
        <p>@((MarkupString)Localizer["BindWayP3"].Value)</p>
    </div>
    <div class="col-12 col-sm-6">
        <Display @bind-Value="@Model.Name" ShowLabel="true" />
    </div>
    <div class="col-12">
        <Divider Text="@Localizer["BindWayNotccupants"]" />
    </div>
    <div class="col-12">
        <p>@((MarkupString)Localizer["BindWayP4"].Value)</p>
    </div>
    <div class="col-12 col-sm-6">
        <Display @bind-Value="@Model.Name" />
    </div>
</div>

@code {
    /// <summary>
    /// Foo 类为Demo测试用，如有需要请自行下载源码查阅
    /// Foo class is used for Demo test, please download the source code if necessary
    /// https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/main/src/BootstrapBlazor.Shared/Data/Foo.cs
    /// </summary>
    [NotNull]
    private Foo? Model { get; set; }

    [Inject]
    [NotNull]
    private IStringLocalizer<Foo>? FooLocalizer { get; set; }

    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Model = Foo.Generate(FooLocalizer);
        Model.Hobby = Foo.GenerateHobbys(FooLocalizer).Take(3).Select(i => i.Text);
    }
}
